package com.ruoyi.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.DevGroup;
import com.ruoyi.system.service.DevGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/DevGroup")
public class DevGroupController extends BaseController {
    @Autowired
    private DevGroupService devGroupService;

    /**
     * 查询所有设备类型
     */
    @GetMapping("/ListType")
    public TableDataInfo ListDevGroup(DevGroup devGroup){
        List<DevGroup>list=devGroupService.ListDevType(devGroup);
        return getDataTable(list);
    }
    /**
     * 新增类型分组
     */
    @PostMapping("/addType")
    public AjaxResult addType(@RequestBody(required = false) DevGroup devGroup){
        return toAjax(devGroupService.addType(devGroup));
    }
    /**
     * 更新
     */
    @PutMapping("/updateType")
    public AjaxResult updateType(@RequestBody(required = false) DevGroup devGroup){
        return toAjax(devGroupService.updateType(devGroup));
    }
    /**
     * 删除类型分组
     */
    @DeleteMapping("/deleteType")
    public AjaxResult delete(Integer GroupId){
        return toAjax(devGroupService.deleteType(GroupId));
    }
}
